package co.baiku.boot.web.controller;

import co.baiku.boot.common.message.Message;
import co.baiku.boot.core.web.controller.BaseController;
import co.baiku.boot.orm.dao.OrderDAO;
import co.baiku.boot.orm.dto.OrderDto;
import co.baiku.boot.orm.po.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/Order")
public class OrderController extends BaseController {

    @Resource
    OrderDAO orderDAO;

    @GetMapping("/sqlFindAll")
    public Message sqlFindAll() {
        List<Order> findAll = orderDAO.templateBuilder("findAll").query(Order.class);
        return Message.result(findAll);
    }

    @GetMapping("/sqlFindAllPartField")
    public Message sqlFindAllPartField() {
        List<OrderDto> findAll = orderDAO.templateBuilder("findAllPartField").query(OrderDto.class);
        return Message.result(findAll);
    }

}
